home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 5
/
Gekikoh Dennoh Club Vol. 5 (Japan).7z
/
Gekikoh Dennoh Club Vol. 5 (Japan) (Track 01).bin
/
internet
/
webx
/
webxp040.lzh
/
Source
/
History.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-08-01
|
2KB
|
90 lines
/* History.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/dos.h>
extern unsigned short history_max;
/* ùÜù≡âeü[âuâïì\æóæ╠ */
typedef struct _history_table {
int current_line;
char url[256];
char old_url[256];
} HISTORY_TABLE;
static HISTORY_TABLE *history_table;
static short history_ptr = 0;
int InitHistory (void)
{
short h;
if ((history_table = _dos_malloc (sizeof (HISTORY_TABLE) * history_max)) == NULL) {
printf ("üª âüâéâèé¬æ½éΦé▄é╣é±üiâqâXâgâèü[ùpé╠âüâéâèé¬èmò█é┼é½é▄é╣é±üj\n");
return(-1);
}
for (h = 0; h < history_max; h++)
*history_table[h].url = '\0'; /* ûóÄgùpé╔ */
return(0);
}
/* ɵô¬é╔âmü[âhé≡éPé┬Æ╟ë┴é╖éΘ */
void AddHistory (char *url, char *old_url, int current_line)
{
short h;
if ((old_url != NULL) && (!strcmp (url, old_url)))
return;
for (h = 0; h < history_max; h++) {
if (!strcmp (history_table[h].url, url)) { /* è∙é╔éáé┴é╜éτÆ╟ë┴é╡é╚éó */
history_table[h].current_line = current_line;
//printf("AddHistory() : %s, %d\n",history_table[h].url,history_table[h].current_line);
return;
}
}
strcpy (history_table[history_ptr].url, url);
if (old_url == NULL) {
*history_table[history_ptr].old_url = '\0';
} else {
strcpy (history_table[history_ptr].old_url, old_url);
}
history_table[history_ptr].current_line = current_line;
if (++history_ptr >= history_max)
history_ptr = 0;
}
/* æOé╠é╠âmü[âhé≡ò╘é╖üiüuû▀éΘüvâ{â^âôÅêù¥üj */
char *BeforeHistory (char *url,int *current_line)
{
short h;
//printf ("in %s\n", url);
*current_line = 0;
for (h = 0; h < history_max; h++) {
//printf ("history_table[%hd] = %s,%d\n", h, history_table[h].url,history_table[h].current_line);
if (!strcmp (history_table[h].url, url)) {
if (*history_table[h].old_url) {
*current_line = history_table[h].current_line;
return (history_table[h].old_url);
} else {
break;
}
}
}
return (NULL);
}
/* ăé╠âmü[âhé≡ò╘é╖üiüuÉié▐üvâ{â^âôÅêù¥üj */
char *NextHistory (void)
{
return (NULL); /* é▄é╛é╚éóé╔éσü[é± */
}